<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas id="canvas" width="600" height="600"></canvas>
    <!-- <img src="./cat.webp" alt=""> -->
    <script>
            var canvas = document.getElementById('canvas')
            var ctx = canvas.getContext('2d')

            var img = new Image()
            img.src = './cat.webp'
            img.onload = function() {
                ctx.drawImage(img, 100, 50, 200, 400,0, 50, 200,400)
            }


    </script>
</body>
</html>